<%@page import="java.util.HashMap"%>
<%@page import="java.util.Map"%>
<%@page import="org.json.simple.JSONArray"%>
<%@page import="vo.CommunityVo"%>
<%@page import="java.util.List"%>
<%@page import="dao.CommunityDao"%>
<%@page language="java" contentType="text/plain; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%
	request.setCharacterEncoding("utf-8");
	//int b_no = Integer.parseInt(request.getParameter("b_no"));
	String b_content=request.getParameter("b_content");
	String menu = request.getParameter("menu_no");
	String cate = request.getParameter("cate_no");
	String title = request.getParameter("title_no");
	CommunityDao cdao = CommunityDao.getDao();
	/* if(b_content!=null){
		CommunityVo cvo = new CommunityVo();
		int menu_no=Integer.parseInt(menu);
		int cate_no=Integer.parseInt(cate);
		int title_no=Integer.parseInt(title);
		int count = CommunityDao.getDao().selectReplyCount(b_no);
		String ip = request.getRemoteAddr();
		cvo.setB_ip(ip);
		cvo.setB_writer("userID");
		cvo.setB_ref(b_no);
		cvo.setB_no(b_no);
		cvo.setB_step(count+1);
		cvo.setB_content(b_content);
		cvo.setMenu_no(menu_no);
		cvo.setCate_no(cate_no);
		cvo.setTitle_no(title_no);
		cdao.replyWrite(cvo);
		
		System.out.println(cvo.getB_writer());
		System.out.println(cvo.getB_ref());
		System.out.println(cvo.getB_no());
		System.out.println(cvo.getB_step());
		System.out.println(cvo.getB_content());
		System.out.println(cvo.getMenu_no());
		System.out.println(cvo.getCate_no());
		System.out.println(cvo.getTitle_no());
		
		
		
		Map<String, Integer> map = new HashMap<String,Integer>();
		map.put("b_reply_count",cvo.getB_step());
		map.put("b_no", cvo.getB_no());
		cdao.updateReplyCount(map);
	}
	 */
	
	int b_no =1;
	List<CommunityVo> reply_list = cdao.selectReplyList(b_no);
	
	JSONArray jarr= new JSONArray();
	jarr.addAll(reply_list);
	
	out.println(jarr.toJSONString(reply_list));

%>